<?php
$this->headTitle('Phân quyền','append');
?>
<div class="dashboard-menu dashboard-admin">
    <span class="back">&nbsp;</span>
    <h1>Phân quyền</h1>
    <?php if($this->acl->checkAllowed(array('moduleName'=>'admin','controllerName'=>'role','actionName'=>'add'))){ ?>
        <a class="btn btn-danger" href="<?php echo $this->url(array('module'=>'admin', 'controller'=>'role', 'action'=>'add'));?>">
            Thêm mới
        </a>
    <?php } ?>
</div>
<div class="row placeholders">
    <div class="col-md-12">
        <div class="widget-big">
            <div class="table table-responsive">
                <div class="search-result">
                    <table class="table table-bordetext-danger table-striped table-condensed table-hover" border="0" cellspacing="0" cellpadding="0">
                        <thead>
                            <tr class="warning">
                                <th>Mã quyền</th>
                                <th>Tên quyền</th>
                                <th>Resource</th>
                                <th>Chức năng</th>
                            </tr>
                        </thead>
                        <tbody>
                        <?php
                            foreach ($this->roleList as $role){
                        ?>
                            <tr>
                                <td class="text-left"><?php echo $role['roleId'];?></td>
                                <td class="text-left">
                                    <?php if($this->acl->checkAllowed(array('moduleName'=>'admin','controllerName'=>'role','actionName'=>'edit'))){ ?>
                                        <a href="<?php echo $this->url(array('module'=>'admin', 'controller'=>'role', 'action'=>'edit', 'id'=>$role['roleId']));?>" title="Sửa thông tin role">
                                            <?php echo $role['roleName'];?>
                                        </a>
                                    <?php }else{ ?>
                                        <?php echo $role['roleName'];?>
                                    <?php } ?>
                                </td>
                                <td class="text-left" width="50%"><?php echo str_replace(array('[',']','","','"'), array('','',', ',''),$role['resourceId']);?></td>
                                <td class="text-left">
                                    <?php if($this->acl->checkAllowed(array('moduleName'=>'admin','controllerName'=>'role','actionName'=>'edit'))){ ?>
                                        <a class="glyphicon glyphicon-pencil" href="<?php echo $this->url(array('module'=>'admin', 'controller'=>'role', 'action'=>'edit', 'id'=>$role['roleId']));?>" title="Sửa thông tin role">
                                            
                                        </a>&nbsp;&nbsp;
                                    <?php 
                                        }
                                        if($this->acl->checkAllowed(array('moduleName'=>'admin','controllerName'=>'role','actionName'=>'delete'))){
                                            if($this->roleCheck['roleId'] != $role['roleId']){
                                    ?>
                                			<a class="glyphicon glyphicon-remove" href="<?php echo $this->url(array('module'=>'admin', 'controller'=>'role', 'action'=>'delete', 'id'=>$role['roleId']));?>" title="Xóa role">
                                                
                                            </a>
                                    <?php 
                                            }
                                        } 
                                    ?>
                                </td>
                            </tr>
                        <?php
                            } 
                        ?>
                        </tbody>
                    </table>
                </div>
            </div>
            <div class="clearfix"></div>
        </div>
    </div>
</div>